﻿namespace Homework3
{
    class Triangle : IShape
    {
        readonly double area;
        readonly bool isValid;
        public Triangle(double tBase, double height)
        {
            if (tBase < 0 || height < 0)
            {
                isValid = false;
                return;
            }
            isValid = true;
            area = tBase * height;
        }
        public double GetArea()
        {
            if (isValid) return area;
            return 0;
        }

        public bool IsValid()
        {
            return isValid;
        }
    }
}
